<%--
   insecptCi
   Copyright (c) 2015 ISPERP
   Version : 1.0.0
 --%>
<%@ tag language="java" pageEncoding="UTF-8"
	trimDirectiveWhitespaces="true"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>

<%@ attribute name="relationId" required="true" type="java.lang.String"
	description="relationId"%>
<%@ attribute name="relationType" required="true"
	type="java.lang.String" description="relationType"%>
<%@ attribute name="readonly" required="false" type="java.lang.Boolean"
	description="readonly"%>



<isperp:mulCiListSelector id="ciSelector" relationId="${relationId }"
	listUrl="task/${relationType}/listCi" 
	saveUrl="task/${relationType}/saveWithCi" afterSelected="categoryCiGrid.reload();"></isperp:mulCiListSelector>

<c:choose>
 <c:when test="${readonly }">
        <isperp:grid gridId="categoryCiGrid" cusViewUrl="configuration/ci/ciResumeView?type=ciaudit"
	url="task/${relationType}/listDetail?relationId=${relationId }"
	cusFormatterActions="true" showSearchbar="false" pager="false" 
	showPager="false" showToolbar="${!readonly }">

	<jsp:attribute name="toolbar">
	<isperp:toolbar id="iconToolbar">
	    <isperp:button text="编辑审计结果" icon="icon-plus" type="button"
				cssClass="button  nui-mainbtn" onclick="editCiAudit();"></isperp:button>
				</isperp:toolbar>
	 </jsp:attribute>
	<jsp:body>
	
	<isperp:column name="id" title="id" hidden="true"></isperp:column>
	<isperp:column name="ci_id" title="ci_id" hidden="true"></isperp:column>
	<isperp:column name="code" title="编号" width="80"></isperp:column>
	<isperp:column name="name" title="资产名称" width="150"></isperp:column>
	<isperp:column name="task_ciaudit_result" title="审核结果" width="150"></isperp:column>
	<isperp:column name="task_ciaudit_date" title="审核日期" width="150" formatter="date"></isperp:column>
	<isperp:column name="conf_category_name" title="资产类型" width="150"></isperp:column>
	<isperp:column name="status" title="状态" width="60"></isperp:column>
	
</jsp:body>
</isperp:grid>
 </c:when>
 <c:otherwise>
      <isperp:grid gridId="categoryCiGrid" cusViewUrl="configuration/ci/ciResumeView?type=ciaudit"
	url="task/${relationType}/listDetail?relationId=${relationId }" 
	cusDeleteUrl="task/${relationType}/delete"
	cusFormatterActions="true" showSearchbar="false" pager="false" 
	showPager="false" showToolbar="${!readonly }">

	<jsp:attribute name="toolbar">
	<isperp:toolbar id="iconToolbar">
	    <isperp:button text="编辑审计结果" icon="icon-plus" type="button"
				cssClass="button  nui-mainbtn" onclick="editCiAudit();"></isperp:button>
				</isperp:toolbar>
	 </jsp:attribute>
	<jsp:body>
	
	<isperp:column name="id" title="id" hidden="true"></isperp:column>
	<isperp:column name="ci_id" title="ci_id" hidden="true"></isperp:column>
	<isperp:column name="code" title="编号" width="80"></isperp:column>
	<isperp:column name="name" title="资产名称" width="150"></isperp:column>
	<isperp:column name="task_ciaudit_result" title="审核结果" width="150"></isperp:column>
	<isperp:column name="task_ciaudit_date" title="审核日期" width="150" formatter="date"></isperp:column>
	<isperp:column name="conf_category_name" title="资产类型" width="150"></isperp:column>
	<isperp:column name="status" title="状态" width="60"></isperp:column>
	
</jsp:body>
</isperp:grid>
 
 </c:otherwise>
</c:choose>


<script type="text/javascript">
    function editCiAudit()
    {
       var selectedIds = $("#categoryCiGrid").jqGrid("getGridParam", "selarrrow");
       if(selectedIds.length==0)
       {
       isperp.errorAlert("请选择资产！");
       return false;
       }
       
       
       var Ids="";
       for(var i=0;i<selectedIds.length;i++)
       {
            
            var id = $("#categoryCiGrid").jqGrid('getRowData',selectedIds[i]).id;
            Ids+=id+",";
       }
       Ids=Ids.substring(0,Ids.length-1);
       isperp.openDialog({
			title : "编辑",
			width:430,
			height:450,
			contentUrl : "task/inspectCiInfo/auditEdit?pcontrolid=categoryCiGrid&ids=" + Ids
		}); 
       
    }
    
</script>